package com.repository;

import com.domain.DoorCar;
import com.domain.DoorRecord;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

public interface RecordRepo extends JpaRepository<DoorRecord,Integer> {
    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(value = "update door_car p set p.model =?1 where p.department = ?2",nativeQuery = true)
    void updateByName(String model, String department);

  @Query(value ="select count(u) from door_record u where u.cardno =?1 and u.note1 =?2 and  like '%?3%'",nativeQuery = true)

    Long countByCardnoAndNote1AndTimeLike(String cardno,String note1,String time);

  Long countByTimeLikeAndCardnoAndNote1(String time,String cadno,String note1);
}
